<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: BaseBattery Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00018.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">BaseBattery Class Reference<div class="ingroups"><a class="el" href="a00516.html">baseModules - base module classes of MiXiM</a> &#124; <a class="el" href="a00530.html">Power consumption - Classes using/defining power consumption</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="BaseBattery" --><!-- doxytag: inherits="BaseModule" -->
<p>Base class for any power source.  
 <a href="a00018.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00266_source.html">BaseBattery.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for BaseBattery:</div>
<div class="dyncontent">
<div class="center"><img src="a00566.png" border="0" usemap="#BaseBattery_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for BaseBattery:</div>
<div class="dyncontent">
<div class="center"><img src="a00567.png" border="0" usemap="#BaseBattery_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00568.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2aa922227a7f1d1c1e8188aaea1a16e5"></a><!-- doxytag: member="BaseBattery::BaseBattery" ref="a2aa922227a7f1d1c1e8188aaea1a16e5" args="(unsigned stacksize)" -->
&#160;</td><td class="memItemRight" valign="bottom"><b>BaseBattery</b> (unsigned stacksize)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00018.html#a6b2ac07e8d11823bdd239de2bfa4563a">registerDevice</a> (const std::string &amp;name, int numAccounts)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers a power draining device with this battery.  <a href="#a6b2ac07e8d11823bdd239de2bfa4563a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00018.html#a4ac1773aef7363fc880a9689706ccc99">draw</a> (int drainID, <a class="el" href="a00087.html">DrawAmount</a> &amp;amount, int account)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Draws power from the battery.  <a href="#a4ac1773aef7363fc880a9689706ccc99"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">State-of-charge interface</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Other host modules should use these interfaces to obtain the state-of-charge of the battery. Do NOT use <a class="el" href="a00032.html" title="residual capacity of battery">BatteryState</a> interfaces, which should be used only by Battery Stats modules. </p>
</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a20ee7721d8da961e3493da63a0fafb81"></a><!-- doxytag: member="BaseBattery::getVoltage" ref="a20ee7721d8da961e3493da63a0fafb81" args="() const =0" -->
virtual double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00018.html#a20ee7721d8da961e3493da63a0fafb81">getVoltage</a> () const =0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">get voltage (future support for non-voltage regulated h/w <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a67c0d2c69f13b6c7ca4a24b23257d83f"></a><!-- doxytag: member="BaseBattery::estimateResidualRelative" ref="a67c0d2c69f13b6c7ca4a24b23257d83f" args="() const =0" -->
virtual double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00018.html#a67c0d2c69f13b6c7ca4a24b23257d83f">estimateResidualRelative</a> () const =0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">current state of charge of the battery, relative to its rated nominal capacity [0..1] <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a15862e04dfa8b40082ecccff79b14ca0"></a><!-- doxytag: member="BaseBattery::estimateResidualAbs" ref="a15862e04dfa8b40082ecccff79b14ca0" args="() const =0" -->
virtual double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00018.html#a15862e04dfa8b40082ecccff79b14ca0">estimateResidualAbs</a> () const =0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">current state of charge of the battery (mW-s) <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab9afb1ddcea070ee4fdf9807521cc806"></a><!-- doxytag: member="BaseBattery::getState" ref="ab9afb1ddcea070ee4fdf9807521cc806" args="() const =0" -->
virtual <a class="el" href="a00098.html#a5002302e0f07bbd982c6e5d65eaa9c3c">HostState::States</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00018.html#ab9afb1ddcea070ee4fdf9807521cc806">getState</a> () const =0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Current state of the battery. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a667ecc08fd49ebadcec8b7eea41102bc"></a><!-- doxytag: member="BaseBattery::BaseBattery" ref="a667ecc08fd49ebadcec8b7eea41102bc" args="(const BaseBattery &amp;)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00018.html#a667ecc08fd49ebadcec8b7eea41102bc">BaseBattery</a> (const <a class="el" href="a00018.html">BaseBattery</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a19d997709c3c25391b2856d8a54e2810"></a><!-- doxytag: member="BaseBattery::operator=" ref="a19d997709c3c25391b2856d8a54e2810" args="(const BaseBattery &amp;)" -->
<a class="el" href="a00018.html">BaseBattery</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00018.html#a19d997709c3c25391b2856d8a54e2810">operator=</a> (const <a class="el" href="a00018.html">BaseBattery</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Base class for any power source. </p>
<p>See "SimpleBattery" for an example implementation.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00193.html" title="A simple linear model of battery consumption.">SimpleBattery</a> </dd></dl>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a4ac1773aef7363fc880a9689706ccc99"></a><!-- doxytag: member="BaseBattery::draw" ref="a4ac1773aef7363fc880a9689706ccc99" args="(int drainID, DrawAmount &amp;amount, int account)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void BaseBattery::draw </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>drainID</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="a00087.html">DrawAmount</a> &amp;&#160;</td>
          <td class="paramname"><em>amount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>account</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Draws power from the battery. </p>
<p>The actual amount and type of power drawn is defined by the passed <a class="el" href="a00087.html" title="Defines the amount of power drawn by a device from a power source.">DrawAmount</a> parameter. Can be an fixed single amount or an amount drawn over time. The drainID identifies the device which drains the power. "Account" identifies the account the power is drawn from. It is used for statistical evaluation only to see which activity of a device has used how much power. It does not affect functionality. </p>

<p>Implemented in <a class="el" href="a00193.html#aae7228c50e302f9f30eea0f1e69ba38b">SimpleBattery</a>.</p>

<p>Referenced by <a class="el" href="a00140.html#a3b26c010451c9d339aa342a4efa3b3d6">MiximBatteryAccess::draw()</a>, <a class="el" href="a00140.html#a523efb31254a730e699983b50dbee44d">MiximBatteryAccess::drawCurrent()</a>, and <a class="el" href="a00140.html#adad54ef2df7fd5bd9b2836a732cef743">MiximBatteryAccess::drawEnergy()</a>.</p>

</div>
</div>
<a class="anchor" id="a6b2ac07e8d11823bdd239de2bfa4563a"></a><!-- doxytag: member="BaseBattery::registerDevice" ref="a6b2ac07e8d11823bdd239de2bfa4563a" args="(const std::string &amp;name, int numAccounts)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual int BaseBattery::registerDevice </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numAccounts</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Registers a power draining device with this battery. </p>
<p>Takes the name of the device as well as a number of accounts the devices draws power for (like rx, tx, idle for a radio device).</p>
<p>Returns an ID by which the device can identify itself to the battery.</p>
<p>Has to be implemented by actual battery implementations. </p>

<p>Implemented in <a class="el" href="a00193.html#abb7866a326788b64466534c95ccb2b52">SimpleBattery</a>.</p>

<p>Referenced by <a class="el" href="a00140.html#a18d72d9f422e37b173dad102b1e6b8a8">MiximBatteryAccess::registerWithBattery()</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/modules/<a class="el" href="a00266_source.html">BaseBattery.h</a></li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00018.html">BaseBattery</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:31 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
